package com.visceb.backstage.controller;
import com.visceb.backstage.dao.loginRepository;
import com.visceb.backstage.dao.weblogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.visceb.backstage.entity.weblog;
import com.visceb.backstage.entity.login;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("weblog")
@CrossOrigin()
public class weblogController {
    @Autowired
    private weblogRepository weblogrepository;
    @Autowired
    private loginRepository loginrepository;

    //    选择对应的课程号的所有评价
    @RequestMapping(value ="/weblogById", method = RequestMethod.GET)
    @ResponseBody
    public List<weblog> findWeblogById(String empId) {
//        System.out.println(empId);
        login thisUser = loginrepository.findFirstByUser(empId);
//        System.out.println(loginrepository.findFirstByUser(empId));
//        System.out.println(thisUser.getSip());
        return weblogrepository.findAllBySip(thisUser.getSip());
    }

}